//
//  EFTransHomeDetailViewCellOne.m
//  EnjogFood
//
//  Created by guocheng on 2017/5/19.
//  Copyright © 2017年 wf. All rights reserved.
//

#import "EFTransHomeDetailViewCellTime.h"
#import "EFTransHomeDetailViewItemTime.h"

@interface EFTransHomeDetailViewCellTime()

@property(strong,nonatomic) UILabel* nameLabel;
@property(strong,nonatomic) UILabel* statusLabel;
@property(strong,nonatomic) UIView* lineView;
@property(strong,nonatomic) UIImageView* moreIV;

@end


@implementation EFTransHomeDetailViewCellTime


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = [UIColor clearColor];
        self.backgroundColor = [UIColor whiteColor];
        [self initView];
    }
    return self;
}

-(void)initView{
    [self.contentView addSubview:self.nameLabel];
    [self.contentView addSubview:self.statusLabel];
    [self.contentView addSubview:self.lineView];
    [self.contentView addSubview:self.moreIV];
}

-(void)layoutSubviews{
    self.nameLabel.left = 20;
    self.nameLabel.top = 14;
    
    self.lineView.left = 20;
    self.lineView.top = self.nameLabel.bottom + 14;
    
    self.statusLabel.top =14;
    
    self.moreIV.left = kScreenWidth - 40;
    self.moreIV.top = 12;
    
}

-(void)setObject:(EFTransHomeDetailViewItemTime *)item{
    [self.nameLabel setText:item.name];
    [self.nameLabel sizeToFit];
    
    NSString* status = [NSString stringWithFormat:@"%@",item.status];
    [self.statusLabel setText:status];
    [self.statusLabel sizeToFit];
    
    self.statusLabel.left = kScreenWidth  - self.statusLabel.width - 40;
}


-(UILabel*)nameLabel{
    if(_nameLabel == NULL){
        _nameLabel = [[UILabel alloc] init];
        _nameLabel.font = [UIFont systemFontOfSize:13];
        _nameLabel.textColor = kBlack999;
    }
    return _nameLabel;
}

-(UILabel*)statusLabel{
    if(_statusLabel == NULL){
        _statusLabel = [[UILabel alloc] init];
        _statusLabel.font = [UIFont systemFontOfSize:13];
        _statusLabel.textColor = kBlack333;
    }
    return _statusLabel;
}

-(UIView*)lineView{
    if(_lineView == NULL){
        _lineView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth - 40, 1)];
        _lineView.backgroundColor = kBlackDDD;
        
    }
    return _lineView;
}

-(UIImageView*)moreIV{
    if(_moreIV == NULL){
        _moreIV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 20, 20)];
        [_moreIV  setImage:IMG(@"more_icon_me_default")];
        
    }
    return _moreIV;
}


@end
